package org.jfk.core.handler;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jfinal.handler.Handler;
import com.jfinal.kit.HandlerKit;
import com.jfinal.kit.PropKit;

public class PageSkipHandler extends Handler {

	@Override
	public void handle(String target, HttpServletRequest request,
			HttpServletResponse response, boolean[] isHandled) {
		String skipPages = PropKit.get("sys.pageSkip");
		
		String[] p = skipPages.split(",");
		
		for (int i = 0 ; p != null &&  i < p.length ; i++){
			if (target.endsWith("."+p[i]))
				HandlerKit.renderError404(request, response, isHandled);
		}
		next.handle(target, request, response, isHandled);
	}

}
